﻿@using TinyForum.Web.Extensions;
@model IEnumerable<TinyForum.Web.Proxies.ServiceReference.TopicDetailDataObject>

@{
    ViewBag.Title = @Site.Settings.SiteTitle + " - Home";
}
<h2>Forum Topics</h2>
<table id="topiclist">
    <tr>
        <td class="topicNameHeader">
            Topics
        </td>
        <td class="totalPostsHeader">
            Total Posts
        </td>
        <td class="latestReplyHeader">
            Latest Reply
        </td>
    </tr>

@foreach (var item in Model) {
    <tr>
        <td class="topicName">
            @Html.ActionLink(item.Topic.Name, "ListPosts", "Topic", new { id = item.Topic.ID }, null)<br />
            <div>@item.Topic.Description</div>
        </td>
        <td class="totalPosts">
            @item.NumOfPosts
        </td>
        <td class="latestReply">
        @if (item.LatestReply != null)
        {
            <div class="poster">@item.LatestReply.User.UserName</div>
            <div class="dateTime">@item.LatestReply.DateCreated.Value.ToString("MM/dd/yyyy HH:mm")</div>
        }
        else
        { 
            @Html.Encode("-");
        }
        
        </td>
        @*<td>
            @Html.ActionLink("Edit", "Edit", new { /* id=item.PrimaryKey */ }) |
            @Html.ActionLink("Details", "Details", new { /* id=item.PrimaryKey */ }) |
            @Html.ActionLink("Delete", "Delete", new { /* id=item.PrimaryKey */ })
        </td>*@
    </tr>
}

</table>
